﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<BlogTagListPaginationViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
    <title>
        <%= Model.Localize("TagsPageTitle")%></title>
    <%= Html.GetCssFile(Url.GetModuleCssPath("MvcEngine.Blog.BackOffice.css")) %>
</asp:Content>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    <div class="page-title" id="post-header">
        <h1>
            <%= Model.Localize("TagsPageHeader")%></h1>
    </div>
    <div class="page-menu">
        <%= Html.UrlActionLink(Model.Localize("BackLink"), Url.Blog(Model.BlogName))%>
        |
        <%= Html.UrlActionLink(Model.Localize("NewLink"), Url.NewTag())%>
    </div>
    <div>
        <% if (!Model.IsCorrectPage) 
           {
           %>
           <%= Model.Localize("TagInvalidPage")%>
           <%
           }
           else if(Model.Tags.Count > 0)
           { %>
        <%= Html.Grid(Model.Tags).Columns(column =>
        {
            column.For(x => Html.UrlActionLink(Html.Image(Url.ImagePath("edit.gif"), Model.Localize("EditAltText")), Url.EditTag(x.Id), false) + 
                Html.PostActionLink(Html.Image(Url.ImagePath("delete.gif"), Model.Localize("DeleteAltText")), Url.DeleteTag(x.Id), Html.DeleteConfirmDialog(), false))
           .Header(Model.Localize("ActionsLabel")).DoNotEncode();
            column.For(x => x.Name).Named(Model.Localize("NameColumn"));
            column.For(x => x.Slug);
                column.For(x => x.CreatedDate).Format("{0:d}");
            column.For(x => x.ModifiedDate).Format("{0:d}");
        }).Attributes(cellSpacing => "0", cellPadding => "0", border => "0")
        .Footers(footer => 
          {
              footer.For(Model.Localize("PagesLabel") + Model.TotalPages.GetPaging(p => Html.UrlActionLink(p.ToString(), Url.BlogTags(p)) + "&nbsp;")).DoNotEncode().Attributes(colspan => "4");
              footer.For(string.Format(Model.Localize("TotalItems"), Model.TotalItems));
          })%>
        <%}
           else
           { %>
        <%= Model.Localize("TagEmptyListMessage")%>
        <%} %>
    </div>
</asp:Content>
